package cn.sgjk.train.business.controller.admin;


import cn.sgjk.train.common.context.LoginMemberContext;
import cn.sgjk.train.common.resp.CommonResp;
import cn.sgjk.train.common.resp.PageResp;
import cn.sgjk.train.business.req.SkTokenQueryReq;
import cn.sgjk.train.business.req.SkTokenSaveReq;
import cn.sgjk.train.business.resp.SkTokenQueryResp;
import cn.sgjk.train.business.service.SkTokenService;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/sk-token")
public class SkTokenAdminController {

    private static final Logger LOG = LoggerFactory.getLogger(SkTokenAdminController.class);
    @Autowired
    private SkTokenService skTokenService;



    @PostMapping("/save")
    public CommonResp<Object> save(@Valid @RequestBody SkTokenSaveReq skTokenReq) {
        skTokenService.save(skTokenReq);
        return new CommonResp<>();
    }



    @GetMapping("/query-list")
    public CommonResp<PageResp<SkTokenQueryResp>> query(@Valid SkTokenQueryReq skTokenQueryReq) {
        PageResp<SkTokenQueryResp> skTokenQueryResps = skTokenService.queryList(skTokenQueryReq);
        return new CommonResp<>(skTokenQueryResps);
    }

    @DeleteMapping("/delete/{id}")
    public CommonResp<Object> delete(@PathVariable Long id) {
        skTokenService.delete(id);
        return new CommonResp<>();
    }
}

